// let p = new Promise(() => {});
// setTimeout(console.log, 1000, p);

// let p1 = new Promise((resolve, reject) => {
//   resolve();
// })
// setTimeout(console.log, 1000, p1)
// let p2 = new Promise((resolve, reject) => {
//   reject();
// })
// setTimeout(console.log, 1000, p2);
// let p1 = new Promise((resolve, reject) => resolve());
// setTimeout(console.log, 0, p1); // Promise <resolved> 
// let p2 = new Promise((resolve, reject) => reject());
// setTimeout(console.log, 0, p2); // Promise <rejected>
// // Uncaught error (in promise)
// new Promise(() => setTimeout(console.log, 0, 'executor'));
// setTimeout(console.log, 0, 'promise initialized');
// let p1 = new Promise((resolve, reject) => setTimeout(resolve, 5000, 'hello world'));
// setTimeout(console.log, 0, p1);

// let p1 = new Promise((resolve, reject) => {
//   reject();
//   resolve();
// })
// setTimeout(console.log, 0, p1);
//超时退出
// let p1 = new Promise((resolve, reject) => {
//   setTimeout(reject, 10000)
// })
// setTimeout(console.log, 0, p1);
// setTimeout(console.log, 11000, p1);
// let p1 = new Promise((resolve, reject) => {
//   resolve();
// })
// let p2 = Promise.resolve();
// setTimeout(console.log, 0, p1)
// setTimeout(console.log, 0, p2)
// setTimeout(console.log, 0, Promise.resolve(1));
// setTimeout(console.log, 0, Promise.resolve(4, 5, 6))
// setTimeout(console.log, 0, Promise.reject(9));
// let p = Promise.resolve('7');
// setTimeout(console.log, 0, p === Promise.resolve(p));
// setTimeout(console.log, 0, p === Promise.resolve(Promise.resolve(p)))

// let p = Promise.reject();
// setTimeout(console.log, 0, p === Promise.resolve(p))

// let p = Promise.resolve(new Error('THIS IS Err'));
// setTimeout(console.log, 0, p);
// let p = Promise.resolve(new Error('foo'));
// setTimeout(console.log, 0, p);

// let p = new Promise((resolve, reject) => {
//   reject();
// })
// let p1 = Promise.reject();
// setTimeout(console.log, 0, p)
// setTimeout(console.log, 0, p1)

// let p = Promise.reject('Promise rejected')
// p.then(null, (p) => {
//   setTimeout(console.log, 0, p) //Promise rejected
// })
// setTimeout(console.log, 0, Promise.reject(Promise.reject('7')))

try {
  throw new Error('foo')
} catch (e) {
  console.log(e);
}
try {
  Promise.reject(new Error('bar'))
} catch (e) {
  console.log(e);
}